package com.lune.job.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lune.job.mapper.UserMenuMapper;
import com.lune.job.pojo.ResPageBean;
import com.lune.job.pojo.UserMenu;
import com.lune.job.service.IUserMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Caiyilin
 * @since 2022-03-06
 */
@Service
public class UserMenuServiceImpl extends ServiceImpl<UserMenuMapper, UserMenu> implements IUserMenuService {

    @Autowired
    private UserMenuMapper userMenuMapper;

    @Override
    public ResPageBean queryPage(Integer currentPage, Integer size, UserMenu userMenu) {
        Page<UserMenu> page = new Page<>(currentPage, size);
        IPage<UserMenu> userMenuIPage= userMenuMapper.queryPage(page,userMenu);
        ResPageBean resPageBean = new ResPageBean(userMenuIPage.getTotal(), userMenuIPage.getPages(), userMenuIPage.getRecords());

        return resPageBean;
    }
}
